Optimal. Leaf size=80 \[ -\frac{a^2 (A-i B) \tan (c+d x)}{d}-\frac{2 a^2 (B+i A) \log (\cos (c+d x))}{d}+2 a^2 x (A-i B)+\frac{B (a+i a \tan (c+d x))^2}{2 d} \]
[Out]
________________________________________________________________________________________
Rubi [A] time = 0.0691261, antiderivative size = 80, normalized size of antiderivative = 1., number of steps used = 3, number of rules used = 3, integrand size = 26, \(\frac{\text{number of rules}}{\text{integrand size}}\) = 0.115, Rules used = {3527, 3477, 3475} \[ -\frac{a^2 (A-i B) \tan (c+d x)}{d}-\frac{2 a^2 (B+i A) \log (\cos (c+d x))}{d}+2 a^2 x (A-i B)+\frac{B (a+i a \tan (c+d x))^2}{2 d} \]
Antiderivative was successfully verified.
[In]
[Out]
Rule 3527
Rule 3477
Rule 3475
Rubi steps
\begin{align*} \int (a+i a \tan (c+d x))^2 (A+B \tan (c+d x)) \, dx &=\frac{B (a+i a \tan (c+d x))^2}{2 d}-(-A+i B) \int (a+i a \tan (c+d x))^2 \, dx\\ &=2 a^2 (A-i B) x-\frac{a^2 (A-i B) \tan (c+d x)}{d}+\frac{B (a+i a \tan (c+d x))^2}{2 d}+\left (2 a^2 (i A+B)\right ) \int \tan (c+d x) \, dx\\ &=2 a^2 (A-i B) x-\frac{2 a^2 (i A+B) \log (\cos (c+d x))}{d}-\frac{a^2 (A-i B) \tan (c+d x)}{d}+\frac{B (a+i a \tan (c+d x))^2}{2 d}\\ \end{align*}
Mathematica [B] time = 2.22004, size = 263, normalized size = 3.29 \[ \frac{a^2 \sec (c) \sec ^2(c+d x) (\cos (2 d x)+i \sin (2 d x)) \left (-8 (A-i B) \cos (c) \cos ^2(c+d x) \tan ^{-1}(\tan (3 c+d x))-i \left ((B+i A) \cos (c+2 d x) \left (4 d x-i \log \left (\cos ^2(c+d x)\right )\right )+2 \cos (c) \left ((A-i B) \log \left (\cos ^2(c+d x)\right )+4 i A d x+4 B d x-i B\right )-2 i A \sin (c+2 d x)+4 i A d x \cos (3 c+2 d x)+A \cos (3 c+2 d x) \log \left (\cos ^2(c+d x)\right )+2 i A \sin (c)-4 B \sin (c+2 d x)+4 B d x \cos (3 c+2 d x)-i B \cos (3 c+2 d x) \log \left (\cos ^2(c+d x)\right )+4 B \sin (c)\right )\right )}{4 d (\cos (d x)+i \sin (d x))^2} \]
Antiderivative was successfully verified.
[In]
[Out]
________________________________________________________________________________________
Maple [A] time = 0.006, size = 123, normalized size = 1.5 \begin{align*} -{\frac{{a}^{2}B \left ( \tan \left ( dx+c \right ) \right ) ^{2}}{2\,d}}-{\frac{{a}^{2}A\tan \left ( dx+c \right ) }{d}}+{\frac{2\,i{a}^{2}B\tan \left ( dx+c \right ) }{d}}+{\frac{i{a}^{2}A\ln \left ( 1+ \left ( \tan \left ( dx+c \right ) \right ) ^{2} \right ) }{d}}+{\frac{{a}^{2}B\ln \left ( 1+ \left ( \tan \left ( dx+c \right ) \right ) ^{2} \right ) }{d}}-{\frac{2\,i{a}^{2}B\arctan \left ( \tan \left ( dx+c \right ) \right ) }{d}}+2\,{\frac{{a}^{2}A\arctan \left ( \tan \left ( dx+c \right ) \right ) }{d}} \end{align*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Maxima [A] time = 1.54547, size = 100, normalized size = 1.25 \begin{align*} -\frac{B a^{2} \tan \left (d x + c\right )^{2} - 2 \,{\left (d x + c\right )}{\left (2 \, A - 2 i \, B\right )} a^{2} - 2 \,{\left (i \, A + B\right )} a^{2} \log \left (\tan \left (d x + c\right )^{2} + 1\right ) +{\left (2 \, A - 4 i \, B\right )} a^{2} \tan \left (d x + c\right )}{2 \, d} \end{align*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Fricas [A] time = 1.4749, size = 339, normalized size = 4.24 \begin{align*} \frac{{\left (-2 i \, A - 6 \, B\right )} a^{2} e^{\left (2 i \, d x + 2 i \, c\right )} +{\left (-2 i \, A - 4 \, B\right )} a^{2} +{\left ({\left (-2 i \, A - 2 \, B\right )} a^{2} e^{\left (4 i \, d x + 4 i \, c\right )} +{\left (-4 i \, A - 4 \, B\right )} a^{2} e^{\left (2 i \, d x + 2 i \, c\right )} +{\left (-2 i \, A - 2 \, B\right )} a^{2}\right )} \log \left (e^{\left (2 i \, d x + 2 i \, c\right )} + 1\right )}{d e^{\left (4 i \, d x + 4 i \, c\right )} + 2 \, d e^{\left (2 i \, d x + 2 i \, c\right )} + d} \end{align*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Sympy [A] time = 7.08905, size = 121, normalized size = 1.51 \begin{align*} - \frac{2 a^{2} \left (i A + B\right ) \log{\left (e^{2 i d x} + e^{- 2 i c} \right )}}{d} + \frac{- \frac{\left (2 i A a^{2} + 4 B a^{2}\right ) e^{- 4 i c}}{d} - \frac{\left (2 i A a^{2} + 6 B a^{2}\right ) e^{- 2 i c} e^{2 i d x}}{d}}{e^{4 i d x} + 2 e^{- 2 i c} e^{2 i d x} + e^{- 4 i c}} \end{align*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Giac [B] time = 1.3872, size = 290, normalized size = 3.62 \begin{align*} \frac{-2 i \, A a^{2} e^{\left (4 i \, d x + 4 i \, c\right )} \log \left (e^{\left (2 i \, d x + 2 i \, c\right )} + 1\right ) - 2 \, B a^{2} e^{\left (4 i \, d x + 4 i \, c\right )} \log \left (e^{\left (2 i \, d x + 2 i \, c\right )} + 1\right ) - 4 i \, A a^{2} e^{\left (2 i \, d x + 2 i \, c\right )} \log \left (e^{\left (2 i \, d x + 2 i \, c\right )} + 1\right ) - 4 \, B a^{2} e^{\left (2 i \, d x + 2 i \, c\right )} \log \left (e^{\left (2 i \, d x + 2 i \, c\right )} + 1\right ) - 2 i \, A a^{2} e^{\left (2 i \, d x + 2 i \, c\right )} - 6 \, B a^{2} e^{\left (2 i \, d x + 2 i \, c\right )} - 2 i \, A a^{2} \log \left (e^{\left (2 i \, d x + 2 i \, c\right )} + 1\right ) - 2 \, B a^{2} \log \left (e^{\left (2 i \, d x + 2 i \, c\right )} + 1\right ) - 2 i \, A a^{2} - 4 \, B a^{2}}{d e^{\left (4 i \, d x + 4 i \, c\right )} + 2 \, d e^{\left (2 i \, d x + 2 i \, c\right )} + d} \end{align*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]